/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package server.so.trening;

import domen.OpstiDomenskiObjekat;
import domen.Trening;
import server.baza.DataBaseBroker;
import server.so.OpstaSO;

/**
 *
 * @author Ivan Ivic
 */
public class SacuvajTrening extends OpstaSO {

    public synchronized  static int sacuvajTrening(Trening trening)
    {
        SacuvajTrening sv = new SacuvajTrening();
        return sv.opsteIzvrsenjeSO(trening);
    }

    @Override
    public int izvrsenjeSO(OpstiDomenskiObjekat odo) {
        Trening t = (Trening) odo;
        signal = DataBaseBroker.getDbb().sacuvajObjekat(t); // 9013, 9014
        return signal;
    }

    @Override
    public boolean stanjeOperacije(int signal) {
        switch(signal)
        {
            case 9013:
                prikazi(signal, "Slog uspesno sacuvan");
                return true;
            case 9014:
                prikazi(signal, "Slog nije uspesno sacuvan");
                return false;
            default:
                return false;
        }
    }
}
